package com.yjd.comm.user.convert;

import java.util.List;

import com.yjd.comm.enums.SexEnum;
import com.yjd.comm.user.model.UserModel;
import com.yjd.comm.user.util.UserUtil;
import com.yjd.comm.util.DateUtil;
import com.yjd.comm.util.FrameUtil;

/**
 * <b>description</b>：用户信息数据转换器 <br>
 * <b>time</b>：2014-11-18上午10:52:25 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class UserModelConvert {

	public static UserModel convert(UserModel model) throws Exception {
		if (model != null) {
			model.getStrMap().put(
					"regdate",
					DateUtil.timestampToDateString(model.getRegdate(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put(
					"lastdate",
					DateUtil.timestampToDateString(model.getLastdate(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put(
					"lastdate",
					DateUtil.timestampToDateString(model.getLastdate(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put(
					"lastdate",
					DateUtil.timestampToDateString(model.getLastdate(),
							DateUtil.PATTERN_yyyy_MM_dd_HH_mm_ss));
			model.getStrMap().put("encUsername",
					UserUtil.disposeUserName(model.getUsername()));
		}
		return model;
	}

	public static List<UserModel> convert(List<UserModel> models)
			throws Exception {
		if (models == null || models.size() == 0) {
			return models;
		}
		for (UserModel model : models) {
			convert(model);
		}
		return models;
	}
}
